//
//  ViewController.m
//  拉钩Login
//
//  Created by Mars_ZXB on 16/7/14.
//  Copyright © 2016年 BAT3. All rights reserved.
//

#import "ViewController.h"
#import "ViewControllerOfLogin.h"
#import "ViewControllerOfGetKey.h"
#import "ViewControllerOfSignIn.h"
@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //添加背景图片
    UIView *viewOfBack = [[UIView alloc] initWithFrame:self.view.frame];
    viewOfBack.backgroundColor = [UIColor blackColor];
    viewOfBack.alpha = 0.7;
    [self.view addSubview:viewOfBack];
    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"welcome_2"]];
    [self.view addSubview:imageView];
    imageView.frame = self.view.frame;
    imageView.alpha = 0.7;
    imageView.userInteractionEnabled = YES;
    //添加图标(中心)
    UIImageView *imageOfFlag = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_lagou"]];
    imageOfFlag.frame = CGRectMake(150, 110, 90, 150);
    [imageView addSubview:imageOfFlag];
    //用户账号密码
    UIView *viewOfUserPassWord = [[UIView alloc] initWithFrame:CGRectMake(10, 280, 355, 81)];
    viewOfUserPassWord.backgroundColor = [UIColor blackColor];
    [imageView addSubview:viewOfUserPassWord];
    viewOfUserPassWord.alpha = 0.7;
    viewOfUserPassWord.layer.masksToBounds = YES;
    viewOfUserPassWord.layer.cornerRadius = 5;
    
    UITextField *textOfUser = [[UITextField alloc] initWithFrame:CGRectMake(10, 280, 355, 40)];
    [imageView addSubview:textOfUser];
    UIImageView *image1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_username"]];
    image1.frame = CGRectMake(10, 280, 30, 30);
    textOfUser.leftView = image1;
    textOfUser.leftViewMode = UITextFieldViewModeAlways;
    
    UIView *viewOfLine = [[UIView alloc] initWithFrame:CGRectMake(10, 320, 355, 1)];
    viewOfLine.backgroundColor = [UIColor whiteColor];
    [imageView addSubview:viewOfLine];
    viewOfLine.alpha = 0.3;
    
    UITextField *textOfPassword = [[UITextField alloc] initWithFrame:CGRectMake(10, 321, 355, 40)];
    [imageView addSubview:textOfPassword];
    UIImageView *image2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_password"]];
    image2.frame = CGRectMake(10, 315, 30, 30);
    textOfPassword.leftView = image2;
    textOfPassword.leftViewMode = UITextFieldViewModeAlways;
    //登录按钮
    UIButton *buttonOfLogin = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfLogin.frame = CGRectMake(10, 380, 355, 40);
    buttonOfLogin.backgroundColor = [UIColor colorWithRed:0.18 green:0.8 blue:0.58 alpha:1];
    [imageView addSubview:buttonOfLogin];
    [buttonOfLogin setTitle:@"登录" forState:UIControlStateNormal];
    [buttonOfLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonOfLogin addTarget:self action:@selector(handleButton:) forControlEvents:UIControlEventTouchUpInside];
    //忘记密码
    UIButton *buttonOfMiss = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfMiss.frame = CGRectMake(0, 430, 100, 20);
    [imageView addSubview:buttonOfMiss];
    [buttonOfMiss setTitle:@"忘记密码" forState:UIControlStateNormal];
    [buttonOfMiss setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonOfMiss addTarget:self action:@selector(handleMiss:) forControlEvents:UIControlEventTouchUpInside];
    //现在注册拉钩
    UIButton *buttonOfLaGou = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfLaGou.frame = CGRectMake(130, 480, 120, 30);
    [imageView addSubview:buttonOfLaGou];
    [buttonOfLaGou setTitle:@"现在注册拉钩" forState:UIControlStateNormal];
    buttonOfLaGou.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    [buttonOfLaGou setTitleColor:[UIColor colorWithRed:0.2 green:0.8 blue:0.58 alpha:1] forState:UIControlStateNormal];
    [buttonOfLaGou addTarget:self action:@selector(handleLagou:) forControlEvents:UIControlEventTouchUpInside];
    //------or-------
    UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(10, 540, 150, 1)];
    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(220, 540, 150, 1)];
    view1.backgroundColor = [UIColor whiteColor];
    view2.backgroundColor = [UIColor whiteColor];
    [imageView addSubview:view1];
    [imageView addSubview:view2];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(180, 530, 30, 20)];
    label.text = @"or";
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont boldSystemFontOfSize:16];
    [imageView addSubview:label];
    //随便逛逛
    UIButton *buttonOfGO = [UIButton buttonWithType:UIButtonTypeSystem];
    buttonOfGO.frame = CGRectMake(150, 580, 80, 30);
    [buttonOfGO setTitle:@"随便逛逛>" forState:UIControlStateNormal];
    [buttonOfGO setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [imageView addSubview:buttonOfGO];
    [buttonOfGO addTarget:self action:@selector(handleGO:) forControlEvents:UIControlEventTouchUpInside];

}
- (void)handleButton:(UIButton *)button
{
    ViewControllerOfLogin *login = [[ViewControllerOfLogin alloc] init];
    [self presentViewController:login animated:YES completion:nil];
}
- (void)handleMiss:(UIButton *)button
{
    ViewControllerOfGetKey *miss = [[ViewControllerOfGetKey alloc] init];
    [self presentViewController:miss animated:YES completion:nil];
}
- (void)handleLagou:(UIButton *)button
{
    ViewControllerOfSignIn *sign = [[ViewControllerOfSignIn alloc] init];
    [self presentViewController:sign animated:YES completion:nil];
}
- (void)handleGO:(UIButton *)button
{
    NSLog(@"点击了随便逛逛");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
